#pragma once
#include <chrono>
#include <utility>

using namespace std;
class TicToc
{
private:
    chrono::time_point<chrono::system_clock> start, end;
    string _message;
public:
    explicit TicToc(string message):_message(std::move(message)){
        tic();
    }

    void tic(){
        start = chrono::system_clock::now();
    }
    double toc(){
        end = chrono::system_clock::now();
        chrono::duration<double>  cost = end - start;
        return cost.count()*1000;
    }

    ~TicToc(){
        cout<<"< "<<_message<<" > cost: "<<toc()<<" ms"<<endl;
    }
};

